<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>艺术品应价交易</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"  />
    <link rel="stylesheet" href="http://jiaoyi.mttxe.com/Mt/css/home.css" />
    <link rel="stylesheet" href="http://jiaoyi.mttxe.com/Mt/css/idangerous.swiper.css" />
    <meta name="__hash__" content="b1da0d61b30bb65ffc18fc48a25543e7_94308cb1910f06a7f379945cfacfdd03" /></head>
<body class="trade_wrapper">
<div class="art_top">
    <div class="art_t_l fl">
        <div class="arrow-left arrow-box" >
            <a onclick="javascript:history.go(-1)"> <b class="aleft"><i class="left-arrow1"></i><i class="left-arrow2"></i></b></a>
        </div>
    </div>
    <div class="art_t_c fl"><span>定向转让</span></div>
</div>

<form class="yx_form">
    <input type="hidden" name="code" value="1003">
    <input type="hidden" id="direct" name="direct" value="">
    <div class="intent_con">
        <div class="intent_con_label">
            <label class="intent_con_labels">产品:</label>
            <span>水墨山涧 1003</span>
        </div>
        <div class="intent_con_label">
            <label  class="intent_con_labels">对方账号:</label>
            <input class="intent_con_label_input" name="mobile" type="text" placeholder="请输入对方账号" />
        </div>
        <div class="intent_con_label">
            <label  class="intent_con_labels">方向:</label>
            <input class="checked-btn intent_con_label_btn btnmar" id="yx_in_btn" data-direct="B" type="button" value="买入" />
            <input class="checked-btn intent_con_label_btn" id="yx_out_btn" data-direct="S" type="button" value="卖出" />
        </div>
        <div class="intent_con_label">
            <label class="intent_con_labels">价格:</label>
            <input class="intent_con_label_input" name="price" type="text" placeholder="请设置转让价格" />
        </div>
        <div class="intent_con_label">
            <label  class="intent_con_labels">数量:</label>
            <input class="intent_con_label_input" type="text" name="volume" placeholder="请设置转让数量" />
        </div>
        <div class="intent_con_label">
            <label class="intent_con_labels">校验码:</label>
            <input class="intent_con_label_input" type="text" name="tradetoken" placeholder="请设置4位数校验码" />
        </div>
        <div class="intent_con_label">
            <label class="intent_con_labels">&nbsp;</label>
            <p><label><input class="intent_con_label_check" type="checkbox" checked disabled/> 我同意《<a id="Button1" onclick="ShowDiv('MyDiv','fade')">定向转让协议</a>》</label></p>
        </div>
        <div class="clear"></div>
        <div class="intent_con_btn">
            <input type="button" id="sub_btn" value="提交" />
        </div>
    </div>
    <input type="hidden" name="__hash__" value="b1da0d61b30bb65ffc18fc48a25543e7_94308cb1910f06a7f379945cfacfdd03" /></form>

<div class="user_pro_list">
    <div class="tabs">
        <ul>
            <li class="active"><a href="javascript:;">我发起的</a></li>
            <li><a href="javascript:;" >我收到的</a></li>
        </ul>
    </div>
    <div id="user-tabs-container" class="swiper-container tableswiper">
        <div class="swiper-wrapper">
            <div class="swiper-slide">
                <div class="user_box new_user_box">
                    <div class="user_box_tit intent_box_tit">
                        <ul>
                            <li class="new-li">产品</li>
                            <li>方向</li>
                            <li class="new-li">对手账号</li>
                            <li>检验码</li>
                            <li>状态</li>
                        </ul>
                    </div>
                    <div class="user_box_table intent_box_table">
                        <ul>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="swiper-slide">
                <div class="user_box new_user_box">
                    <div class="user_box_tit intent_box_tit">
                        <ul>
                            <li class="new-li">产品</li>
                            <li>方向</li>
                            <li class="new-li">发起人</li>
                            <li>校验码</li>
                            <li>状态</li>
                        </ul>
                    </div>
                    <div class="user_box_table intent_box_table">
                        <ul>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<form class="yx_trade_form">
    <input type="hidden" id="token_hidden" name="ask_token" value="">
    <input type="hidden" id="code_hidden" name="code" value="">
    <input type="hidden" id="contract_hidden" name="contract" value="">
    <input type="hidden" id="volume_hidden" name="volume" value="">
    <input type="hidden" id="price_hidden" name="price" value="">
    <input type="hidden" id="direct_hidden" name="direct" value="">
    <input type="hidden" id="ask_uid" name="ask_uid" value="">
    <div class="hidden_box">
        <div class="hidebox"></div>
        <div class="ok_box">
            <div class="ok_box_con">
                <h2>确认接受 <span id="mobile"></span> 发起的意向交易，</h2>
                <p><label>校验码:</label><b id="token"></b></p>
                <p><label>产品:</label><span id="name"></span></p>
                <p><label>产品代码:</label><span id="code"></span></p>
                <p><label>方向:</label><span id="direct_text"></span></p>
                <p><label>价格:</label><span id="price"></span></p>
                <p><label>数量:</label><span id="volume"></span></p>
            </div>
            <div class="ok_box_foot">
                <input type="button" class="closeBox" value="取&nbsp;&nbsp;消" />
                <input type="button" value="接受交易" id="ok_box_ok" />
            </div>
        </div>
    </div>
    <input type="hidden" name="__hash__" value="b1da0d61b30bb65ffc18fc48a25543e7_94308cb1910f06a7f379945cfacfdd03" /></form>

<!--定向转让协议-->
<div id="fade" class="black_overlay"></div>
<div id="MyDiv" class="fx_content">
    <div class="clause_word">
        <div class="close" onclick="CloseDiv('MyDiv','fade')">关闭</div>
        <div class="clause_detail">
            <h4>
                美通天下文化艺术电商平台定向转让相关规则
            </h4>
            <p>
                一、定向转让时间：转让日15:01-16:00
            </p>
            <p>
                二、报价范围：当日应价转让收盘价的正负30%以内，含30%。
            </p>
            <p>
                三、定向转让流程：
            </p>
            <p>
                1、转让双方线下协商，达成转让意向；
            </p>
            <p>
                2、一方通过定向转让功能向对方发送转让请求，在对方应答操作之前，可以撤销请求；
            </p>
            <p>
                3、对方收到转让请求后，可以进行两种应答操作：同意或拒绝。如对方选择同意，则定向转让成功；如对方选择拒绝，则应填写说明拒绝原因，发送后请求方可查阅该信息；
            </p>
            <p>
                4、定向转让数量计入商户整体持仓量，定向转让的价格不体现在转让行情数据上；
            </p>
            <p>
                5、当日16:00时收盘后，未应答的定向转让请求会被系统自动撤销。
            </p>
            <p>
                四、定向转让手续费；向转让方和受让方分别收取成交额的千分之五。
            </p>
            <p>
                五、该规则自发布日起生效。
            </p>
            <p>
                六、协议最终解释权归美通天下文化艺术电商平台所有。
            </p>            <!--<p class="notice_butn"><input type="button" value="不同意" onclick="CloseDiv('MyDiv','fade')">&nbsp;&nbsp;<input type="button" value="同意" onclick="CloseDiv('MyDiv','fade')"></p>-->
        </div>
    </div>
</div>
<div id="fadeBox" class="fadeBox_bg"></div>

<script type="text/javascript" src="http://jiaoyi.mttxe.com/Mt/js/jquery.js"></script>
<script type="text/javascript" src="http://jiaoyi.mttxe.com/Mt/js/idangerous.swiper.min.js"></script>
<script type="text/javascript">
    //弹出隐藏层
    function ShowDiv(show_div,bg_div){
        document.getElementById(show_div).style.display='block';
        document.getElementById(bg_div).style.display='block' ;
        var bgdiv = document.getElementById(bg_div);
        bgdiv.style.width = document.body.scrollWidth;
        $("#"+bg_div).height($(document).height());
    }
    //关闭弹出层
    function CloseDiv(show_div,bg_div)
    {
        document.getElementById(show_div).style.display='none';
        document.getElementById(bg_div).style.display='none';
    }
    $(function(){
        $(".user_box_one").find(".hide_ul").eq(0).css("height",'34px');
        var tabsSwiper = new Swiper('#user-tabs-container',{
            speed:500,
            onSlideChangeStart: function(){
                $(".tabs .active").removeClass('active')
                $(".tabs li").eq(tabsSwiper.activeIndex).addClass('active')
            }
        })
        $(".tabs li").on('touchstart mousedown',function(e){
            e.preventDefault();
            $(".tabs .active").removeClass('active');
            $(this).addClass('active');
            tabsSwiper.swipeTo( $(this).index() );
        })
        $(".tabs li").click(function(e){
            e.preventDefault();
        });
        $(".checked-btn").on("click",function(){
            $(".checked-btn").removeClass("on");
            $(this).addClass("on");
        });
        $(".click_dl").on("click",function(){
            $(".hide_ul").height("0");
            $(this).find(".hide_ul").height("30px");
        });

        $(function(){
            $(".ok_acc").on("click",function(){
                $("#mobile").html($(this).data("mobile"));
                $("#token").html($(this).data("token"));
                $("#name").html($(this).data("name"));
                $("#code").html($(this).data("code"));
                $("#direct_text").html($(this).data("direct-text"));
                $("#price").html($(this).data("price"));
                $("#volume").html($(this).data("volume"));

                $("#token_hidden").val($(this).data("token"));
                $("#code_hidden").val($(this).data("code"));
                $("#direct_hidden").val($(this).data("direct"));
                $("#price_hidden").val($(this).data("price"));
                $("#volume_hidden").val($(this).data("volume"));
                $("#contract_hidden").val($(this).data("cid"));
                $("#ask_uid").val($(this).data("ask_uid"));

                $(".hidden_box").addClass("show_box");
            });
            $(".closeBox").on("click",function(){
                $(".hidden_box").removeClass("show_box");
            });
        });
        //交易方向
        $(".intent_con_label_btn").on('click',function(){
            var direct = $(this).data("direct");
            $("#direct").val(direct);
        });
        //定向转让
        $("#sub_btn").on('click',function(){
            var data = $('.yx_form').serialize();
            $.post("/index.php?s=/user/askintent.html",{'data':data},function(data){
                if (data.status == 1){
                    alert(data.msg);
                    history.go(0);
                }else {
                    alert(data.msg);
                }
            },'json');
        });
        //取消定向转让
        $(".cancel_btn").on('click',function(){
            var cid = $(this).data('cid');
            var data = 'cid='+cid;
            $.post("/index.php?s=/user/cancelyx.html",{'data':data},function(data){
                if (data.status == 1){
                    alert(data.msg);
                    history.go(0);
                }else {
                    alert(data.msg);
                    return false;
                }
            },'json');
        });
        //接受定向转让
        $("#ok_box_ok").on('click',function(){
            var data = $(".yx_trade_form").serialize();

            $.post("/index.php?s=/user/bidintent.html",{'data':data},function(data){
                if (data.status == 1){
                    alert(data.msg);
                    history.go(0);
                }else {
                    alert(data.msg);
                }
            },'json');
        });

        $(document).on('change','.yx_form input[name="price"],.yx_form input[name="volume"]',function(date){
            var direct = $(".yx_form input[name=direct]").val();
            var price = $(".yx_form input[name=price]").val();
            var volume = $(".yx_form input[name=volume]").val();
            if(isFinite(price)) {
                var trading_quote= "1";
                $(".yx_form input[name=price]").val(decimal(parseFloat(price),trading_quote));

            } else {
                $(".yx_form input[name=price]").val('');
            }
            if(direct == 'B') {
                checkLogin('yx_in',price);
            }
        });
        $("#yx_out_btn").on('click',function(){
            var code = '1003';
            checkLogin('yx_out',price=0);
        });
        $("#yx_in_btn").on('click',function(){
            $(".yx_form input[name=volume]").attr('placeholder','请设置转让数量');
        });
        //检查登录状态
        function checkLogin(type,price=0) {
            var code = '1003';
            var type = type;
            var url = '/index.php?s=/index/gettips/code/codestr/type/typestr/price/pricestr.html';
            url = url.replace('codestr',code);
            url = url.replace('typestr',type);
            url = url.replace('pricestr',price);
            $.get(url,function(data){
                if(data.status == 1) {
                    if(type == 'yx_in') {
                        $(".yx_form input[name=volume]").attr('placeholder',data.msg);
                    } else if(type == 'yx_out') {
                        $(".yx_form input[name=volume]").attr('placeholder',data.msg);
                    }
                } else {
                    window.location.href = '/index.php?s=/user/login.html';
                }
            });
        }
        //四舍五入
        function decimal(num,v){
            var vv = Math.pow(10,v);
            return Math.round(num*vv)/vv;
        }
    });
</script>
</body>
</html>